home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------- setting_calls.c ------------------------------*/
- /* Copyright 1989 Brown University -- Jeffrey Vogel */
- /*----------------------------------------------------------------------------*/
-
- /*--------------------------------- Includes ---------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- #include "qd_local.h"
-
-
- /*------------------------------- SetLineWidth -------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- SetLineWidth(lineWidth)
- int lineWidth;
- {
- /*** error check ***/
- if (!QDrunning) {
- QDerror("ERROR SetLineWidth: QuickDraw not initialized.");
- return;
- }
- if ((lineWidth < LINE_WIDTH__MIN) || (lineWidth > LINE_WIDTH__MAX)) {
- QDerror("ERROR SetLineWidth: Illegal line width.");
- return;
- }
-
- QDgcValues.line_width = lineWidth;
- XChangeGC(QDdisplay, QDgc, GCLineWidth, &QDgcValues);
- }
-
- /*------------------------------- GetLineWidth -------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- GetLineWidth(lineWidth)
- int *lineWidth;
- {
- if (!QDrunning) {
- QDerror("ERROR GetLineWidth: QuickDraw not initialized.");
- return;
- }
-
- *lineWidth = QDgcValues.line_width;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /*------------------------------- SetLineStyle -------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- SetLineStyle(style)
- LineStyles style;
- {
- if (!QDrunning) {
- QDerror("ERROR SetLineStyle: QuickDraw not initialized.");
- return;
- }
-
- if (style == LINE_STYLE__SOLID) {
- QDgcValues.line_style = LineSolid;
- XChangeGC(QDdisplay, QDgc, GCLineStyle, &QDgcValues);
- }
- else if (style == LINE_STYLE__ON_OFF_DASH) {
- QDgcValues.line_style = LineOnOffDash;
- XChangeGC(QDdisplay, QDgc, GCLineStyle, &QDgcValues);
- }
- else if (style == LINE_STYLE__DOUBLE_DASH) {
- QDgcValues.line_style = LineDoubleDash;
- XChangeGC(QDdisplay, QDgc, GCLineStyle, &QDgcValues);
- }
- else {
- QDerror("ERROR SetLineStyle: Invalid line style.");
- }
- }
-
-
- /*------------------------------- GetLineStyle -------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- GetLineStyle(style)
- LineStyles *style;
- {
- if (!QDrunning) {
- QDerror("ERROR GetLineStyle: QuickDraw not initialized.");
- return;
- }
-
- switch (QDgcValues.line_style) {
- case LineSolid:
- *style = LINE_STYLE__SOLID;
- break;
- case LineOnOffDash:
- *style = LINE_STYLE__ON_OFF_DASH;
- break;
- case LineDoubleDash:
- *style = LINE_STYLE__DOUBLE_DASH;
- break;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
- /*--------------------------------- PenMode ----------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- PenMode(mode)
- PenModes mode;
- {
- if (!QDrunning) {
- QDerror("ERROR PenMode: QuickDraw not initialized.");
- return;
- }
-
- if (mode == patXor) {
- QDgcValues.function = GXxor;
- XChangeGC(QDdisplay, QDgc, GCFunction, &QDgcValues);
- }
- else if (mode == patCopy) {
- QDgcValues.function = GXcopy;
- XChangeGC(QDdisplay, QDgc, GCFunction, &QDgcValues);
- }
- else {
- QDerror("ERROR PenMode: Invalid write mode.");
- }
- }
-
-
- /*-------------------------------- GetPenMode --------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- GetPenMode(mode)
- PenModes *mode;
- {
- if (!QDrunning) {
- QDerror("ERROR GetPenMode: QuickDraw not initialized.");
- return;
- }
-
- switch (QDgcValues.function) {
- case GXcopy:
- *mode = patCopy;
- break;
- case GXxor:
- *mode = patXor;
- break;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /*--------------------------------- SetFont ----------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- SetFont(font)
- Fonts font;
- {
- if (!QDrunning) {
- QDerror("ERROR SetFont: QuickDraw not initialized.");
- return;
- }
-
- if (font == FONT__SMALL) {
- QDgcValues.font = QDfonts[FONT__SMALL];
- XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
- }
- else if (font == FONT__MEDIUM) {
- QDgcValues.font = QDfonts[FONT__MEDIUM];
- XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
- }
- else if (font == FONT__LARGE) {
- QDgcValues.font = QDfonts[FONT__LARGE];
- XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
- }
- else if (font == FONT__LARGEST) {
- QDgcValues.font = QDfonts[FONT__LARGEST];
- XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
- }
- else {
- QDerror("ERROR SetFont Invalid font.");
- }
- }
-
- /*--------------------------------- GetFont ----------------------------------*/
- /*----------------------------------------------------------------------------*/
-
- void
- GetFont(font)
- Fonts *font;
- {
- if (!QDrunning) {
- QDerror("ERROR GetFont: QuickDraw not initialized.");
- return;
- }
-
- if (QDgcValues.font == QDfonts[FONT__SMALL])
- *font = FONT__SMALL;
- else if (QDgcValues.font == QDfonts[FONT__MEDIUM])
- *font = FONT__MEDIUM;
- else if (QDgcValues.font == QDfonts[FONT__LARGE])
- *font = FONT__LARGE;
- else if (QDgcValues.font == QDfonts[FONT__LARGEST])
- *font = FONT__LARGEST;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-